// 测试环境连接配置
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function (app) {
  app.use(
    createProxyMiddleware('/yst-tms', {
      // target: 'https://nrp-dev.elitescloud.com', // 测试环境
      target: 'https://nrp-test.zrhsh.com', // 测试环境00
      changeOrigin: true,
      secure: false
    }),
    createProxyMiddleware('/yst-pur', {
      // target: 'https://nrp-dev.elitescloud.com', // 测试环境
      target: 'https://nrp-test.zrhsh.com', // 测试环境00
      changeOrigin: true,
      secure: false
    }),
    createProxyMiddleware('/yst-inv', {
      // target: 'https://nrp-dev.elitescloud.com', // 测试环
      target: 'https://nrp-test.zrhsh.com', // 测试环境00境
      changeOrigin: true,
      secure: false
    }),
    createProxyMiddleware('/yst-support', {
      // target: 'https://nrp-dev.elitescloud.com', // 测试环境
      target: 'https://nrp-test.zrhsh.com', // 测试环境00
      // target: 'http://localhost:8080', //本地
      changeOrigin: true,
      secure: false
    }),
    createProxyMiddleware('/yst-b2c', {
      target: process.env.REACT_APP_SERVER_HOST, // 测试环境
      changeOrigin: true,
      secure: false
    }),
    createProxyMiddleware('/yst-order', {
      // target: process.env.REACT_APP_SERVER_HOST, // 测试环境
      // target: 'https://nrp-dev.elitescloud.com', // 测试环境00
      target: 'https://nrp-test.zrhsh.com', // 测试环境00
      changeOrigin: true,
      secure: false
      // pathRewrite: {
      //   '^/yst-order': ''
      // }
    }),

    createProxyMiddleware('/yst-fin', {
      // target: process.env.REACT_APP_SERVER_HOST, // 测试环境
      // target: 'https://nrp-dev.elitescloud.com', // 测试环境
      target: 'https://nrp-test.zrhsh.com', // 测试环境00
      // target: 'http://192.168.1.172:8080', //dong
      // target: 'http://192.168.1.71:8080', //昊阳
      changeOrigin: true,
      secure: false
    }),
    createProxyMiddleware('/coordinator', {
      // target: 'http://192.168.0.238:7877/', // 测试环境
      target: 'https://nrp-test.zrhsh.com', // 测试环境00
      changeOrigin: true,
      secure: false
    }),
    createProxyMiddleware('/yst-workflow-demo', {
      // target: 'http://localhost:9000', // 测试环境 。
      target: 'https://nrp-test.zrhsh.com', // 测试环境00
      changeOrigin: true,
      secure: false
    }),
    createProxyMiddleware('/yst-workflow', {
      target: 'https://nrp-test.zrhsh.com', // 测试环境
      changeOrigin: true,
      secure: false
    }),
    createProxyMiddleware('/yst-system', {
      // target: 'http://101.132.189.202:30027/yst/system', // 测试环境
      target: 'https://nrp-test.zrhsh.com', // 测试环境00
      changeOrigin: true,
      secure: false
      // pathRewrite: {
      //   '^/yst-system': ''
      // }
    }),

    createProxyMiddleware('/yst-sale', {
      // target: 'https://nrp-dev.elitescloud.com', // 测试环境
      target: 'https://nrp-test.zrhsh.com', // 测试环境00
      // target: 'http://192.168.1.147:8082', //zhao 01

      changeOrigin: true,
      secure: false
      // pathRewrite: {
      //   '^/yst-sale': ''
      // }
    }),
    createProxyMiddleware('/auth', {
      // target: 'http://192.168.0.210:9001', // 测试环境
      // target: 'http://101.132.189.202:30027/yst', // 测试环境
      target: 'https://nrp-test.zrhsh.com', // 测试环境00
      changeOrigin: true,
      secure: false
    })
  );
};

/**
 * 测试环境swagger: http://192.168.1.50:8080/yst-b2c/doc.html
 * 注意修改target后需要重新yarn start
 *     createProxyMiddleware('/yst-tms', {
      target: 'http://26dcc524.cpolar.cn', // 测试环境
      changeOrigin: true, //跨域
      secure: false // 校验https证书
      // pathRewrite: { '': '' },
      // pathRewrite: {
      // '^/yst-fc': ''
      // }
    }),
 */